<?
include("session.php");
$id = "";
if(isset($_GET['id'])) {
	$id = $_GET['id'];
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../webkit/utils/jquery.js"></script>
<script type="text/javascript" src="../webkit/utils/form.checker.js"></script>
<script type="text/javascript" src="../webkit/datepicker/WdatePicker.js"></script>
<link type="text/css" rel="stylesheet" href="page.css"/> 
<body  bgcolor="#f4f4f4" style="margin:0px;" scroll=no>

<form name=f> 
<table width=100% cellspacing=1 cellpadding=3 id="basic_info_table"> 
	<tr>
		<td align=right>咨询内容</td><td colspan=3><textarea style="width:500px;" rows=10 id="content"></textarea></td>
	</tr>
</table>
	<input type='hidden' id="id">
</form>	


<table width=100% cellspacing=1 cellpadding=3>
	<tr>
		<td align=center>
		<hr size=1>
		<input type="button" id="btn_save" class="button" value="保存信息" onclick="save()">　　<input type="button" class="button" value="关闭窗口" onclick="parent.closeDlg()"></td>
	</tr>
</table>

<script type="text/javascript">
	var op = "<?echo $_GET['op']?>";
	var f = document.f;
	function save() { 
		if(FormChecker.doCheck(f)) {
			var params = {};
			var els = f.elements;
			for(var i=0; i<els.length; i++) {
				if(els[i].type == "button") continue;
				params[els[i].id] = els[i].value;
			}
			
			if(confirm('确定要保存信息吗？')) {
				$.post("info_query.php?action="+op, params, function(data) {
					if(data.indexOf("ok") == 0) {
						alert("数据保存成功!");
						parent.refreshGrid();
						parent.closeDlg();
					} else {  
						alert(data);
					}
				});
			}
		}
	}

	

	$(function() {
		<?
		if($_GET['op'] == 'edit') {
		?>
		$.get("info_query.php?action=get&id=<?echo $_GET['id']?>", function(data){
			eval("var row = "+data);
			for(var k in row) {
				$('#'+k).val(row[k]);
			}
		});
		<?
		}
		?>
	});

</script>
</body>
</html>